/**
 * Project: apollo-base-commons
 * 
 * File Created at 2016年10月25日
 * 
 * Copyright 2015-2016 dx.com Croporation Limited.
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of
 * DongXue software Company. ("Confidential Information").  You shall not
 * disclose such Confidential Information and shall use it only in
 * accordance with the terms of the license agreement you entered into
 * with dx.com.
 */
package com.dx.pf.commons.async.pool;

import java.util.Map;

import com.dx.pf.commons.async.core.AsyncTask;
import com.dx.pf.commons.log.Logger;

/** 
* @ClassName: AsyncRunnable 
* @Description: TODO(这里用一句话描述这个类的作用) 
* @author wuzhenfang(wzfbj2008@163.com)
* @date 2016年10月25日 下午3:53:22 
* @version V1.0 
*/
public abstract class AsyncRunnable extends AsyncTask implements AsyncPoolCallable<Void> {

	private static Logger logger = Logger.getLogger(AsyncRunnable.class);

	public AsyncRunnable() {
	};

	public AsyncRunnable(Map<String, Object> dataMap) {
		this.dataMap = dataMap;
	}

	public abstract void doAsync(Map<String, Object> dataMap);

	public Void call() {
		run();
		return null;
	}

	public void run() {
		try {
			doAsync(dataMap);
		} catch (Throwable e) {
			logger.error("async runnable invoke error", e);
		}
	}
}
